Previous Book Contents Book Index Next

Inside Macintosh: AppleScript Scripting Additions Guide /
Chapter 2 - Scripting Addition Commands / Command Definitions
/


Run Script

The Run Script command runs a specified script or script file. It is the only command provided by the Run Script scripting addition.

SYNTAX
run script referenceOrString                          ¬
   [ with parameters listOfParameters ]               ¬
   [ in scriptingComponent ]
PARAMETERS
referenceOrString
A reference of the form file nameString or alias nameString that specifies a script file, or a string that consists of a valid script.
Class: Reference or string

listOfParameters
A list of parameters to be passed to the Run handler of the target.
Class: List

scriptingComponent
The name of the scripting component to use when running
the script.
Class: String
RESULT
Value returned by script that is run.

EXAMPLES
This example runs the script beep 3, causing the alert sound to sound
three times.

run script "beep 3"
This example ensures that the script beep 3 is run by the AppleScript scripting component.

run script "beep 3" in "AppleScript"
This example runs Run handler in the script file called MyScript.

run script file "MyVolume:MyDirectory:MyScript"
NOTES
To specify the name (nameString) of a script file, use a string of the form "Disk:Folder1:Folder2:...:Filename" as described in Chapter 5, "Objects
and References," of the AppleScript Language Guide. If you specify only the name of the file (Filename) instead of its entire pathname, AppleScript
attempts to find the file in the current directory.

ERRORS
Error
number
Error message
-50Parameter error.
-108Out of memory.
-192Bad name for file.
-1700Can't make some data into the expected type.
-1701Some parameter is missing for <commandName>.
-1704Some parameter was invalid.
-1705Operation involving a list item failed.
-1708<reference> doesn't understand the <commandName> message.
-1718Reply has not yet arrived.
-1750Scripting component error.
-1751Invalid script id.
-1753Script error.

Previous Book Contents Book Index Next

© Apple Computer, Inc.
18 DEC 1996